package com.uduemc.biso.master.backend.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import com.uduemc.biso.master.backend.interceptor.LoginInterceptor;

@Component
public class WebMvcConfiguration extends WebMvcConfigurerAdapter {

	@Autowired
	private LoginInterceptor loginInterceptor;

	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		super.addInterceptors(registry);
		// 站点内容拦截器
		this.myAddInterceptors(registry);
	}

	/**
	 * 站点内容拦截器，专门过滤网站内容
	 * 
	 * @param registry
	 */
	protected void myAddInterceptors(InterceptorRegistry registry) {
		// 创建拦截器链表
		registry.addInterceptor(loginInterceptor).addPathPatterns("/backend/**");
	}

}
